package com.chuangjiangx.member.manager.basic.web.config;

import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;

import java.io.IOException;

/**
 * @author 陈智
 * @date 2018/6/28
 */
@Configuration
@Import({
        DruidConfig.class,
        MybatisConfig.class,
        RedisConfig.class,
        WebConfig.class
})
public class AppConfig {

    // configProperties属性加载，TODO: 后续删除该加载
    @Bean
    public PropertiesFactoryBean configProperties() throws IOException {
        PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
        PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
        propertiesFactoryBean.setLocations(resolver.getResources("classpath:conf.properties"));
        return propertiesFactoryBean;
    }

}
